package about_attributes.demo1;

import about_stack.MyThread;

/**
 * @author yuisama
 * @date 2022/09/28 21:17
 **/
public class Main3 {
    static class MyThread extends Thread{
//        public MyThread(){
//            //构造方法报错的原因可能是拼写错误
//            setName("我是门小静");
//        }

        //thread类本身提供的改名方法
        public MyThread(){
            super("我是小门");
        }
        @Override
        public void run() {
            System.out.println(this.getName());
        }

        public static void main(String[] args) {
            Thread thread = Thread.currentThread();//当前线程
            System.out.println(thread.getName());

            MyThread t1 = new MyThread();
            t1.start();

            MyThread t2 = new MyThread();
            t2.start();

            MyThread t3 = new MyThread();
            t3.start();
        }
    }
}

